#ifndef UTILS_HPP
#define UTILS_HPP
#include "HTTPRequest.hpp"
#include "sonic/sonic.h"
#include "spdlog/spdlog.h"

#include <string>
using member_itr_type = typename sonic_json::Document::MemberIterator;
enum data_type { data_string, data_int64, data_array, data_object };
namespace Utils {
http::Response send_message(const std::string &message, const std::string &url);
http::Response get_message(const std::string &url,const int number = 1);
member_itr_type proc_resp_get_message(http::Response &resp);
void show_member_value(member_itr_type m, data_type _type = data_type::data_array);
member_itr_type proc_resp_send_message(http::Response &resp);
void update_config(const std::string& path = "../config/config.json", const std::string &key="base_url",const std::string &value="http://127.0.0.1:8090");
void config_write(const std::string& path = "../config/config.json",const std::string &key="base_url",const std::string &value="http://127.0.0.1:8090");
void usage();
} // namespace Utils
#endif
